﻿#ifndef PST_DIALOGTRACER2DSETTINGS_H
#define PST_DIALOGTRACER2DSETTINGS_H

#include <IdaDialogFrame>

#include "DataModelPost.h"

QT_BEGIN_NAMESPACE
namespace Ui
{
    class DialogTracer2DSettings;
};
QT_END_NAMESPACE

class QTableWidget;

namespace pst
{
    class DialogTracer2DSettings : public IdaDialogFrame
    {
        Q_OBJECT

    public:
        DialogTracer2DSettings(QWidget* parent = nullptr);
        ~DialogTracer2DSettings();

        void initWidget();

        void initData(const DataTracer2DSettings dataTracer2DSettings);

        void ChangeVariableText(const QString& variableText);
        void EnableHeatmapTracer(bool isHeatmapTracer);
        void ChangeCurrentWidget(int index);
        void setTracerPropertyWidgetRowIndex(int index);
        void setCurrentMarkerIndex(int index);
        void setExistMarkerMap(QHash<int, QString> map);
        void setTracerID(int tracerID) {m_tracerID = tracerID;};
        void setGuideLineID(int guideLineID) {m_guideLineID = guideLineID;};

    signals:
        void signal_sendData(int tracerID, int guideLineID);

    private slots:

        void reject() override;

        void accept() override;

        void slot_apply();

    private:
        QTableWidget* initData_tracer();
        QTableWidget* initData_guideLine();

        void saveUIData_tracer();
        void saveUIData_guideLine();

        void updateUIData_tracer();
        void updateUIData_guideLine();

    private:
        Ui::DialogTracer2DSettings* ui;
        int m_tracerID{-1};
        int m_guideLineID{-1};
        bool m_isHeatmapTracer;
        Style2D_TracerProperty* m_tracerProperty;
        QTableWidget* m_tableWidget_tracer;
        Style2D_GuideLineProperty* m_guideLineProperty;
        QTableWidget* m_tableWidget_guideLine;
        int m_tracerPropertyWidgetRowIndex;
        bool m_execSuccessFlag;
        int m_currentMarkerIndex;
        QHash<int, QString> m_existMarkerMap = {};
    };
} // namespace pst
#endif // PST_DIALOGTRACER2DSETTINGS_H
